import 'package:flutter/material.dart';

class ShawnButton extends StatefulWidget {
  final String title;

  const ShawnButton({super.key, required this.title});

  @override
  State<ShawnButton> createState() => _ShawnButtonState();
}

class _ShawnButtonState extends State<ShawnButton> {
  @override
  Widget build(BuildContext context) {
    Widget myText = Center(
      child: Text(
        widget.title,
        style: TextStyle(
          color: Colors.white,
          fontSize: 20,
          fontWeight: FontWeight.bold,
        ),
      ),
    );
    return getChildByCard();
  }

  Widget getChild2() {
    return ClipRRect(
      borderRadius: BorderRadius.circular(20.0), // 圆角半径
      child: Container(
        color: Colors.blue,
        height: 100,
        width: 100,
        child: Center(
          child: Text(
            widget.title,
            style: TextStyle(
              color: Colors.white,
              fontSize: 20,
              fontWeight: FontWeight.bold,
            ),
          ),
        ),
      ),
    );
  }

  Widget getChild(Widget myWidget) {
    return Container(
      width: 100,
      height: 100,
      decoration: BoxDecoration(
        color: Colors.blue,
        borderRadius: BorderRadius.circular(20.0), // 可选：为容器添加圆角
        boxShadow: [
          BoxShadow(
            color: Colors.grey.withOpacity(0.5), // 阴影颜色
            spreadRadius: 2, // 阴影展开的范围
            blurRadius: 5, // 阴影模糊程度
            offset: Offset(0, 3), // 阴影偏移量
          ),
        ],
      ),
      child: myWidget, // 这里放置你的视图或控件
    );
  }

  Widget getChildByCard() {
    return Card(
      elevation: 5, // 阴影深度
      child: ClipRRect(
        borderRadius: BorderRadius.circular(20.0), // 圆角半径
        child: Container(
          color: Colors.blue,
          height: 120,
          width: 120,
          child: Center(
            child: Text(
              widget.title,
              style: TextStyle(
                color: Colors.white,
                fontSize: 20,
                fontWeight: FontWeight.bold,
              ),
            ),
          ),
        ),
      ), // 这里放置你的视图或控件
    );
  }
}
